package com.smarttest.dagger.di

import android.app.Application
import com.smarttest.base.BaseApp
import com.smarttest.net.ApiModule
import dagger.BindsInstance
import dagger.Component
import dagger.android.AndroidInjectionModule
import dagger.android.AndroidInjector
import dagger.android.support.AndroidSupportInjectionModule
import javax.inject.Singleton

/**
 * 说明：
 * Created by code_nil on 2018/1/30.
 * 君子自强不息
 */
@Singleton
@Component(modules = [
    AndroidInjectionModule::class,//基础组件的注解(Activity、Fragment、BroadcastReceive、Service)
    AndroidSupportInjectionModule::class,//v4包的Fragment注解
    AppModule::class,//app的module，可以得到application提供的实例
    ApiModule::class,//api的module,得到网络实例
//    DaoModule::class,//数据库的module
    ActivityModule::class])
interface AppComponent : AndroidInjector<BaseApp> {
    @Component.Builder
    interface Builder {

        @BindsInstance
        fun application(application: Application): Builder

        fun build(): AppComponent
    }
}